package cn.com.demo.tp40.controller;

import cn.com.demo.microservice.reps.ResponseObject;
import cn.com.demo.tp40.service.MainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("role")
public class MainController {
    @Autowired
    private MainService mainService;
    @GetMapping("delete/{id}")
    public ResponseObject deleteRole(@PathVariable("id") int id){
        ResponseObject res = new ResponseObject();
        int num = -1;
        num = this.mainService.deleteById(id);
        if (num != -1){
            res.setMessage("删除成功");

        }else {
            res.setCode(50008);
            res.setMessage("删除失败");
        }
        return res;
    }
}
